﻿:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color: #1a1a1a;
  background-color: transparent;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #f5f7ff, #edf1ff 35%, #e8f3ff 100%);
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 32px;
  color: inherit;
}

#app {
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  background: #ffffffcc;
  border-radius: 24px;
  box-shadow: 0 24px 60px -32px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  backdrop-filter: blur(14px);
}

.app__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 32px 32px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.app__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.app__subtitle {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 16px;
}

.app__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  text-align: right;
}

.app__session-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: #94a3b8;
}

.app__session-id {
  font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1e293b;
}

.app__reset {
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  background: #1d4ed8;
  color: #ffffff;
  transition: background 0.2s ease, transform 0.2s ease;
}

.app__reset:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 32px 32px;
}

.chat__history {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

.chat__history::-webkit-scrollbar {
  width: 8px;
}

.chat__history::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background-color: rgba(148, 163, 184, 0.6);
}

.chat__placeholder {
  text-align: center;
  color: #64748b;
  padding: 48px 24px;
  border: 1px dashed #cbd5f5;
  border-radius: 16px;
}

.chat__placeholder h2 {
  margin: 0 0 12px;
  color: #1d4ed8;
  font-size: 20px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 92%;
  align-items: flex-start;
}

.message--assistant {
  align-self: flex-start;
}

.message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message--user .message__avatar {
  background: #0ea5e9;
}

.message__bubble {
  padding: 14px 18px;
  border-radius: 18px;
  background: #1e293b;
  color: #ffffff;
  position: relative;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message--assistant .message__bubble {
  background: #f1f5f9;
  color: #0f172a;
}

.message__cursor {
  display: inline-block;
  width: 10px;
  height: 18px;
  margin-left: 4px;
  background: currentColor;
  opacity: 0.7;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(8px);
}

.composer__input {
  min-height: 96px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid #cbd5f5;
  padding: 16px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer__input:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.composer__input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

.composer__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.composer__button {
  border: none;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #1d4ed8;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.composer__button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.composer__button:not(:disabled):hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.composer__button--ghost {
  background: transparent;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.composer__button--ghost:hover {
  background: rgba(148, 197, 253, 0.2);
}

.composer__error {
  color: #b91c1c;
  font-size: 13px;
  text-align: right;
}

@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .app {
    min-height: calc(100vh - 32px);
    border-radius: 18px;
  }

  .app__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app__meta {
    align-items: flex-start;
  }

  .chat {
    padding: 16px;
  }

  .chat__history {
    padding: 18px;
  }

  .composer__actions {
    flex-direction: column;
    align-items: stretch;
  }
}
